package com.zjlanyun.erp.approve;

import com.zjlanyun.erp.Common;
import com.zjlanyun.erp.R;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.TextView;

public class ApproveForm extends Activity {

	private Button btn_submit;
	private LinearLayout ll_back;
	private TextView title;
	private String trantype;
	private int approveType;
	private Intent intent;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.approve_form);

		initView();

	}

	// 初始化View
	private void initView() {
		title = (TextView) findViewById(R.id.title);
		ll_back = (LinearLayout) findViewById(R.id.ll_back);
		btn_submit = (Button) findViewById(R.id.btn_submit);
		
		intent = getIntent();
		trantype = intent.getStringExtra("trantype");
		approveType = intent.getIntExtra("approveType", 1);
		if(approveType == 1){
			title.setText("同意."+Common.getApproveType().get(trantype));
		}else if(approveType == 2){
			title.setText("驳回上级."+Common.getApproveType().get(trantype));
		}else if(approveType == 3){
			title.setText("驳回制单人."+Common.getApproveType().get(trantype));
		}
		
		
		// 提交
		btn_submit.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View arg0) {
				intent.putExtra("result", true);
				setResult(1, intent);
				finish();
			}
		});
		
		//后退
		ll_back.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View arg0) {
				finish();
			}
		});
	}
}
